<?php
// +----------------------------------------------------------------------
// | 卡券
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2024 http://www.yicmf.com, All rights reserved.
// +----------------------------------------------------------------------
// | Author: 微尘 <yicmf@qq.com>
// +----------------------------------------------------------------------
namespace app\controller\api\v3;


use app\model\app\Video as VideoModel;

class Video extends Common
{

    /**
     * 视频组合
     */
    public function gets()
    {
        $data['lists'] = VideoModel::with(['user','cover'])->where('status',1)->where('video_url','<>','')->order('sort ASC')->paginate();
        return $this->successAjax($data);
    }
    public function grp()
    {
//        $names =  ExchangeCouponModel::where('status',1)
//            ->where('is_sale',1)->select();
//
//        foreach ($names as $name) {
//
////            $u['name_type'] =   str_replace(["\r\n", "\n", "\r"], "", nl2br($name['name_type']));;  //strip_tags($name['name_type']);
////            $u['time_name'] =   str_replace(["\r\n", "\n", "\r"], "", nl2br($name['time_name']));;  //strip_tags($name['name_type']);
////            $u['top_name'] =   str_replace(["\r\n", "\n", "\r"], "", nl2br($name['top_name']));;  //strip_tags($name['name_type']);
//            $u['name_type'] =  trim($name['name_type']);  //strip_tags($name['name_type']);
//            $u['time_name'] =  trim($name['name_type']);
//            $u['top_name'] =   trim($name['name_type']);
//            ExchangeCouponModel::where('id',$name['id'])->update($u);
//
//
//        }


        $name_type =  ExchangeCouponModel::where('status',1)
            ->where('is_sale',1) ->distinct(true)
            ->field('name_type')->column('name_type');

        dump($name_type);
    }

    /**
     * 优惠券主页
     */
    public function create()
    {
        $event = new ExchangeCouponEvent();
        $data = $event->order($this->request->param(),$this->user);
        return $this->autoAjax($data);
    }


}
